import React,{useState,createContext} from 'react';
import { Todolist } from './Todolist';
import {TodolistContext} from './context'

const App = ()=>{
  const [isShow,setIsShow] = useState(true);
  const [list,setList] = useState([1,2,3]);
  const addItem = (val)=>{
    setList([val,...list]);
  }
    return(
      <TodolistContext.Provider value={{list,addItem}}>
        <Todolist />
  
        <button onClick={()=>setIsShow(!isShow)}>显示/隐藏</button>
      </TodolistContext.Provider>
  
    );
}

export default App;